<h1>Editing book</h1>

<%= error_messages_for :book %>

<% form_for(@book) do |f| %>
	<p>
		<%= f.label :title %>
		<%= f.text_field :title %>
	</p>
  <p>
		<%= f.label :author %>
		<%= f.text_field :author %>
	</p>
	<p>
		<%= f.label :isbn%>
		<%= f.text_field :isbn %>
	</p>
	<p> <strong>Catégorie(s) :</strong>
		<% for category in Category.find(:all) do %>
			<%= check_box_tag "book[category_ids][]", category.id, @book.categories.include?(category) %>
			<%= h category.label %>
		<% end %>
	</p>
	<p>
    <%= f.submit "Update" %>
  </p>
<% end %>

<%= link_to 'Show', @book %> |
<%= link_to 'Back', books_path %>
